home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Interactive 7
/
PC World Interactive 7.iso
/
program
/
cprog.EXE
/
CC_1.ZIP
/
GETS.C
< prev
next >
Encoding:
Amiga
Atari
Commodore
DOS
FM Towns/JPY
Macintosh
Macintosh JP
Macintosh to JP
NeXTSTEP
RISC OS/Acorn
Shift JIS
UTF-8
Wrap
C/C++ Source or Header
|
1988-02-01
|
512 b
|
24 lines
/*
** get a string from "stdin"
** terminate with \0
*/
extern int *stdin, fgetc();
gets(s) char *s; {
int n, ch;
char *str;
str=s; /* save original value */
n = 256;
while(--n) {
ch=fgetc(stdin);
if(ch<0) {
*s='\0';
return 0;
}
if(ch=='\n') break;
*s++=ch;
}
*s='\0';
return str;
}